<?php $this->load->view('config/header');?>
<h3>Saran content</h3>
<div class="line-separtor"></div>
<br/>
	<a href="<?php echo site_url()?>saran/add" class="btn btn-primary"> Saran baru </a>
	<div class="input-append" id="search" style="float:right">
	<form method="post" class="form-horizontal" action="<?php echo site_url() ?>saran/searchData" >
		<input class="span3" id="appendedInputButtons" name="name" type="text">
		<input type="submit" name="submit" value="Search" class="btn" />
	</form>
	</div>
<br/>
<br/>
<br/>	
	<?php $success = $this->session->flashdata('success');?>
	<?php if ($success):?>
		<div class="alert alert-success">
			Data telah tersimpan
		</div>
	<?php endif?>
	
	<?php $error = $this->session->flashdata('error');?>
	<?php if ($error):?>
		<div class="alert alert-error">
			Data gagal tersimpan
		</div>
	<?php endif?>
	
	<?php $delete = $this->session->flashdata('delete');?>
	<?php if ($delete):?>
		<div class="alert alert-success">
			Data telah terhapus
		</div>
	<?php endif?>
<br/>
<table class="table table-condensed table-hover">
	<thead>
		<th>#</th>
		<th>Nama penyaran</th>
		<th>Email penyaran</th>
		<th>Tgl. buat saran</th>
		<th>Aksi</th>
	</thead>
	<tbody>
		<?php if (@$results):?>
			<?php $i=1;?>
			<?php foreach ($results as $row):?>
			<tr>
				<td><?php echo $i;?></td>
				<td><?php echo $row['nama_saran']?></td>
				<td><?php echo $row['email_saran']?></td>
				<td><?php echo date('d-m-Y', strtotime($row['date_saran']))?></td>
				<td>
					<a href="<?php echo site_url()?>saran/edit/<?php echo $row['id_saran']?>" class="icon-edit"></a>&nbsp;
					<a href="<?php echo site_url()?>saran/delete/<?php echo $row['id_saran']?>" class="icon-trash" onclick="return confirm('Anda yakin akan menghapus data ini?');"></a>
				</td>
			</tr>
			<?php $i++;?>
			<?php endforeach?>
		<?php else:?>
			<tr>
				<td colspan="5">
					<br/>
					<div class="alert alert-error" style="text-align:center">
						Tidak ada record
					</div>
				</td>
			</tr>
		<?php endif?>
	</tbody>
</table>
<?php $this->load->view('config/footer');?>